package com.atguigu.java.ai.langchain4j.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {

    @Tool(name = "加法",value = "计算两个数字的和")
    double sum(@P(value = "第一个数字", required = true) double a, @P(value = "第二个数字", required = true) double b) {
    	System.out.println("调用加法运算");
    	return a + b;
    }
    
    @Tool(name = "平方根",value = "计算一个数字的平方根")
    double squareRoot(@P(value = "数字", required = true) double x) {
        System.out.println("调用平方根运算");
        return Math.sqrt(x);
    }
}